package ro.isdc.training.ejb3.student.domain;

import java.util.List;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import ro.isdc.training.ejb3.misc.domain.Person;

/**
 * Student class
 * 
 * @author Andrei Chirila
 */
public class Student extends Person {

	/**
	 * Generated Serial Version UIDs
	 */
	private static final long serialVersionUID = 3890153645300085287L;

	/**
	 * Student enrollments
	 */
	private List<Enrollment> enrollments;

	/**
	 * @return the enrollments
	 */
	public List<Enrollment> getEnrollments() {
		return enrollments;
	}

	/**
	 * @param enrollments
	 *          the enrollments to set
	 */
	public void setEnrollments(final List<Enrollment> enrollments) {
		this.enrollments = enrollments;
	}
	
	/**
	 * Adds an enrollment to the list of enrollments.
	 * 
	 * @param enrollment
	 */
	public void addEnrollment(final Enrollment enrollment) {
	  enrollments.add(enrollment);
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append(
				"dateOfBirth", this.dateOfBirth).append("lastName", this.lastName)
				.append("versioNo", this.versionNo).append("entityId", this.entityId)
				.append("SSN", this.SSN).append("sexType", this.sexType).append(
						"firstName", this.firstName).append("creationTimestamp",
						this.creationTimestamp).append("lastUpdateTimestamp",
						this.lastUpdateTimestamp).toString();
	}

}
